//
//  DCProgressTableViewCell.m
//  Driver
//
//  Created by 大橙子 on 2018/11/7.
//  Copyright © 2018 Tomous. All rights reserved.
//

#import "DCProgressTableViewCell.h"
@interface DCProgressTableViewCell ()
@property (nonatomic,strong) UILabel *typeLabel;

@property (nonatomic,strong) UILabel *colorLabel;
@end
@implementation DCProgressTableViewCell
-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self setUpMainView];
    }
    return self;
}
-(void)setUpMainView
{
    UIButton *chooseBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    [chooseBtn setImage:IMAGENAME(@"方框") forState:UIControlStateNormal];
    [chooseBtn setImage:IMAGENAME(@"选择-方框") forState:UIControlStateSelected];
    chooseBtn.userInteractionEnabled = NO;
    self.chooseBtn = chooseBtn;
    [self addSubview:chooseBtn];
    
    self.typeLabel = [self getLabelWithFont:14 textAlignment:NSTextAlignmentCenter];
    [self addSubview:self.typeLabel];
    
    self.VINLabel = [self getLabelWithFont:14 textAlignment:NSTextAlignmentLeft];
//    self.VINLabel.text = @"BABFCHEUW1738353";
    [self addSubview:self.VINLabel];
    
    self.colorLabel = [self getLabelWithFont:14 textAlignment:NSTextAlignmentCenter];
    [self addSubview:self.colorLabel];
}
-(void)layoutSubviews
{
    [super layoutSubviews];
    self.chooseBtn.frame = CGRectMake(0, (self.height - 20)/2, 20, 20);
    self.VINLabel.frame = CGRectMake(self.chooseBtn.right+5, 0, self.width/2, self.height);
    self.typeLabel.frame = CGRectMake(self.VINLabel.right, 0, self.width/4, self.height);
    self.colorLabel.frame = CGRectMake(self.typeLabel.right, 0, self.typeLabel.width, self.height);
}
-(void)setModel:(DCDispatchModel *)model
{
    _model = model;
//    self.VINLabel.text = [model.VIN cutStr];
//    self.typeLabel.text = model.type;
//    self.colorLabel.text = model.color;
}
-(void)updateCellWithState:(BOOL)select
{
    self.chooseBtn.selected = select;
    _isSelected = select;
}
-(UILabel *)getLabelWithFont:(NSInteger)font textAlignment:(NSTextAlignment)textAlignment
{
    UILabel *label = [[UILabel alloc]init];
    label.font = FONT(font);
    label.textAlignment = textAlignment;
    return label;
}
- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
